package com.example.weibo3;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import android.content.Intent;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.example.weibo3.adapter.ViewPagerAdapter;

import java.util.List;

public class PhotoActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);  // 设置全屏
        setContentView(R.layout.activity_photo);

        Intent intent = getIntent();
//        String image = intent.getStringExtra("image");
        // 取数据
        List<String> images = (List<String>) intent.getSerializableExtra("image");
//        ImageView imageView = findViewById(R.id.image);  // 图片组件
//        Glide.with(this)
//                .load(image)
//                .into(imageView);

        // 初始化adapter
        ViewPagerAdapter viewPagerAdapter =
                new ViewPagerAdapter(this, images);

        // 关联viewpager和adapter
        ViewPager viewPager = findViewById(R.id.view_pager);
        viewPager.setAdapter(viewPagerAdapter);
    }
}